package com.yty.demo._11_reflection;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author: yangtaoyao
 * @time: 2020/1/15 14:02
 * @description:
 */
public class ProxyDemo implements InvocationHandler {
    Object obj;//被代理的对象

    public ProxyDemo(Object obj) {
        this.obj = obj;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("========方法开始执行=======");
        Object res=method.invoke(this.obj,args);
        System.out.println("方法执行结束");
        return res;
    }
}
